package com.xinqi.modules.homework.homework.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.homework.homework.domain.CourseHomeworkEntity;
import com.xinqi.modules.homework.homework.dto.req.CourseHomeworkQueryDTO;
import com.xinqi.modules.homework.homework.dto.req.CourseHomeworkStudentDetailDTO;
import com.xinqi.modules.homework.homework.dto.req.CourseHomeworkTimerQueryDTO;
import com.xinqi.modules.homework.homework.dto.rsp.CourseHomeworkDetailResultDTO;
import com.xinqi.modules.homework.homework.dto.rsp.CourseHomeworkResultDTO;
import com.xinqi.modules.stats.assistant.dto.rsp.AssistantTotalResultDTO;
import com.xinqi.modules.stats.assistant.dto.rsp.StudentInfoResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 课程作业配置表数据层
 *
 * @author: system
 * @date: 2023/03/08
 */
@Mapper
public interface CourseHomeworkMapper extends SuperMapper<CourseHomeworkEntity> {

    /**
     * 已发布
     */
    IPage<CourseHomeworkResultDTO> homeworkInfoListRelease(Page page, @Param("query") CourseHomeworkQueryDTO dto);

    /**
     * 未发布
     */
    IPage<CourseHomeworkResultDTO> homeworkInfoListNoRelease(Page page, @Param("query") CourseHomeworkQueryDTO dto);

    /**
     * 查询作业内容基本信息包含老师信息
     */
    CourseHomeworkDetailResultDTO homeworkDetail(CourseHomeworkTimerQueryDTO query);


    /**
     * 作业提交未提交统计
     */

    AssistantTotalResultDTO selectHomeworkTakeTotal(@Param("contentId") Long contentId, @Param("times") Integer times);

    /**
     * 作业提交未提交学生列表
     *
     * @param status 0 未提交 1已提交
     */

    List<StudentInfoResultDTO> selectHomeworkTakeStudent(@Param("contentId") Long contentId, @Param("times") Integer times, @Param("status") Integer status);

    /**
     * 根据id查询详情
     *
     * @param id
     * @return
     */
    CourseHomeworkResultDTO findDetailById(@Param("id") Long id, @Param("query") CourseHomeworkStudentDetailDTO dto);

    /**
     * 根据小组Id获取进行中的小组作业
     *
     * @param classId 班级ID
     * @param groupId 小组ID
     * @author dzy
     */
    List<CourseHomeworkEntity> selectRunningGroupHomework(@Param("classId") Long classId, @Param("groupId") Long groupId);

}
